package com.quxue.im.controller;

import com.quxue.im.req.friend.*;
import com.quxue.im.service.IChatFriendService;
import com.quxue.im.vo.AjaxResult;
import com.quxue.im.vo.friend.FriendVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 好友表 前端控制器
 * </p>
 *
 * @author jinken
 * @since 2023-11-10
 */
@RestController
@RequestMapping("/friend")
public class ChatFriendController {

    @Autowired
    private IChatFriendService friendService;

    @RequestMapping("/friendList")
    public AjaxResult friendList(){

       List<FriendVo> friendList =  friendService.friendList();

       return AjaxResult.success(friendList);
    }
    @RequestMapping("/info/{friendId}")
    public AjaxResult info(@PathVariable Long friendId){

       FriendVo friendVo =  friendService.getFriendInfo(friendId);

       return AjaxResult.success(friendVo);
    }

    @RequestMapping("/findFriend")
    public AjaxResult info(@RequestBody FindFriendReq findFriendReq){

        FriendVo friendVo =  friendService.findFriend(findFriendReq.getParam());

        return AjaxResult.success(friendVo);
    }


    @RequestMapping("/remark")
    public AjaxResult remark(@RequestBody RemarkReq remarkReq){
        friendService.remark(remarkReq);
        return AjaxResult.success();
    }

    @RequestMapping("/black")
    public AjaxResult black(@RequestBody BlackReq blackReq){
        friendService.black(blackReq);
        return AjaxResult.success();
    }
    @RequestMapping("/delFriend")
    public AjaxResult delFriend(@RequestBody DelFriendReq delFriendReq){
        friendService.delFriend(delFriendReq);
        return AjaxResult.success();
    }

    @RequestMapping("/top")
    public AjaxResult top(@RequestBody TopReq topReq){
        friendService.top(topReq);
        return AjaxResult.success();
    }






}
